<?php
include ("banner.html");
include ("dogs.php");

if (isset($_REQUEST['oldemail']))
//if "email" is filled out, send email
  {
  
  //sjekk at newemail stemmer med newemail2
  
  //send email
  $email = $_REQUEST['oldemail'] ;
  $email2 = $_REQUEST['newemail'] ;
  $email3 = $_REQUEST['newemail2'] ;
  
  if($email2 == $email3){
    
	$to = "$email";
	$subject = "Email byttet";
	$message = "Hei, dette er en automatisk melding om at e-post adressen har blitt forandret til $email2";
mail($to,$subject,$message);
changeEmail($email, $email2);
echo "Mail Sent.";
}
else {
echo "Du har skrevet feil epost, sjekk at de stemmer";
}
  }  
else
//if "email" is not filled out, display the form
  {
echo "Du må fylle inn feltene";
  }
?>
</body>
</html>
